String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}
/*** Check if the number ***/ 
String.prototype.isNumber = function () {
	var s = this.trim(); 
	return (s.search(/^[+-]?[ 0-9 .]*$/) >= 0);
}
/********* FIN VALIDAR *************/

function checkEmail(inputvalue){	
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	return pattern.test(inputvalue);
}
// JavaScript Document
function obtenerFoco(form,campo,mensaje)
{
       var obj        =eval("document.forms."+form);
       var clave =eval("obj."+campo);

       if( ! esObjeto( obj ) )
               return;
       
       if( ! esObjeto( clave ) )
               return;

       if( clave.value==mensaje )
       {
               clave.value='';
               return;
       }
}

function perderFoco(form,campo,mensaje)
{
       var obj=eval( "document.forms."+form);
       var clave =eval("obj."+campo);
       if( ! esObjeto( obj ) )
               return;
       
       if( ! esObjeto( clave ) )
               return;

       if( clave.value=='' )
       {
               clave.value=mensaje;
               return;
       }
}

function esObjeto( obj )
{
       if( typeof( eval( 'obj' ) )!='object' )
               return false;
       
       return true;
}


function soloEnterosKH(evento){
	var keynum;
	var keychar;
	
	if(window.event){
		keynum = evento.keyCode;		
	}else if(evento.which){
		keynum = evento.which;
	}
	
	if(keynum == 8 || keynum == undefined){
		return true;
	}	
	if(keynum == 32){
		return false;
	}		
		
	keychar = 	String.fromCharCode(keynum);
	return (!isNaN(keychar));
}

function GridSelection(objType) {
    var oItem = objType.children;
    var SelectedCtrl = (objType.type == "radio") ? objType : objType.children.item[0];
    bChecked = SelectedCtrl.checked;
    arrRButtons = SelectedCtrl.form.elements;
    for (i = 0; i < arrRButtons.length; i++) {
        if (arrRButtons[i].type == "radio" && arrRButtons[i].id != SelectedCtrl.id)
            arrRButtons[i].checked = !bChecked;
    }
}